package com.topisv.tms.repository.stock.instorage;

import java.util.List;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.stock.instorage.InstorageUpTask;

/**
 * 入库上架任务_dao
 * @author ch
 *
 */
public interface InstorageUpTaskDao extends PagingAndSortingRepository<InstorageUpTask, Long>, JpaSpecificationExecutor<InstorageUpTask> {

	@Query("select t from InstorageUpTask t where t.taskCode=?")
	InstorageUpTask loadByTaskCode(String taskCode);
	
	@Query("select t from InstorageUpTask t where t.workerUuid=? and (t.status='token' or t.status='doing')")
	List<InstorageUpTask> loadMyTask(String workerUuid);

	@Query("select t from InstorageUpTask t where t.billCode=? and ( t.status='undo' or t.status='token' or t.status='doing' )")
	List<InstorageUpTask> loadUnfinishTask(String billCode);
	
	@Query("select t from InstorageUpTask t where t.billCode=? ")
	List<InstorageUpTask> loadByBillCode(String billCode);

}